package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.protocol.RpcRequest;
import com.lagou.rpc.DiscoverService;
import com.lagou.service.IUserService;

public class ConsumerBoot {



    public static void main(String[] args) throws Exception {

        String serverName = "/com.lagou.server";
        DiscoverService.discover(serverName);


        //2.循环给服务器写数据
        while (true){
            int a = DiscoverService.getTcpLink().size();
            if(DiscoverService.getTcpLink().size() > 0){
                //1.创建代理对象
                IUserService service = (IUserService) RPCConsumer.createProxy(IUserService.class);
                String result = service.sayHello("are you ok !!");
                System.out.println("服务端返回状态"+result);
                Thread.sleep(1000);
            }

        }

    }
}
